/*
 * Copyright (c) Jiandong.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */


import { ReactNativeHost } from './ReactNativeHost';

import Ability from '@ohos.application.Ability'
import Window from '@ohos.window'
import hilog from '@ohos.hilog';

import { ReactDelegate } from "./ReactDelegate"

export class ReactActivityDelegate {
    private static readonly mConcurrentRootEnabled: boolean = false
    private static readonly TAG = "ReactActivityDelegate"

    private mReactDelegate: ReactDelegate

    public constructor(private mMainComponentName?: string, private harmonyPageName?: string) {}

    public onCreate(want, launchParam) {
      this.mReactDelegate = new ReactDelegate(this.mMainComponentName, this.harmonyPageName)
      this.mReactDelegate?.onHostCreate(want, launchParam);
    }

    public onDestroy() {
      this.mReactDelegate?.onHostDestroy();
    }

    public onWindowStageCreate(windowStage: Window.WindowStage) {
      this.mReactDelegate?.onHostWindowStageCreate(windowStage);
    }

    public onWindowStageDestroy() {
        this.mReactDelegate?.onHostWindowStageDestroy();
    }

     public onForeground() {
        this.mReactDelegate?.onHostForeground();
    }

    public onBackground() {
        this.mReactDelegate?.onHostBackground();
    }

    public isConcurrentRootEnabled(): boolean {
        return ReactActivityDelegate.mConcurrentRootEnabled;
    }
}
